import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:mobile_vpn/common/cpn/cpn_view_state.dart';
import 'package:mobile_vpn/pages/set_up/set_logic.dart';
import '../../common/cpn/sliver_app_bar.dart';
import '../../router/routers.dart';
import '../../theme/color_palettes.dart';

class SetPage extends CpnViewState<SetLogic> {

  const SetPage({Key? key}) : super(key: key, bindViewState: false);
  @override
  Widget buildBody(BuildContext context) {
    return CustomScrollView(
      slivers: [
        commonSliverAppBar(
          title: '设置',

        ),
        SliverToBoxAdapter(
          child: Padding(
            padding: EdgeInsets.all(20.w),
            child: Column(
              children: [
                SizedBox(height: 20.h),
                _buildSettingItem(
                  icon: Icons.notifications,
                  title: '通知设置',
                  onTap: () {
                    AppRoutes.jumpPage(AppRoutes.notificationSettingPage);
                  },
                ),
                // SizedBox(height: 20.h),
                // _buildSettingItem(
                //   icon: Icons.rocket_launch,
                //   title: '加速模式',
                //   onTap: () {
                //     AppRoutes.jumpPage(AppRoutes.acceleratedModePage);
                //   },
                // ),
                SizedBox(height: 20.h),
                _buildSettingItem(
                  icon: Icons.palette,
                  title: '颜色主题',
                  onTap: () {
                    AppRoutes.jumpPage(AppRoutes.colorPage);
                  },
                ),
              ],
            ),
          ),
        ),
      ],
    );
  }

  // 构建设置项
  Widget _buildSettingItem({
    required IconData icon,
    required String title,
    required VoidCallback onTap,
  }) {
    return GestureDetector(
      onTap: onTap,
      child: Container(
        padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 20.w),
        decoration: BoxDecoration(
          color: ColorPalettes.instance.background,
          borderRadius: BorderRadius.circular(10.r),
        ),
        child: Row(
          children: [
            Icon(
              icon,
              color: ColorPalettes.instance.firstIcon,
                size: 26.sp
            ),
            SizedBox(width: 16.w),
            Text(
              title,
              style: TextStyle(
                fontSize: 32.sp,
                color: ColorPalettes.instance.firstText,
              ),
            ),
            const Spacer(),
            Icon(
              Icons.arrow_forward_ios,
              color: ColorPalettes.instance.secondText,
                size:28.sp
            ),
          ],
        ),
      ),
    );
  }
}


